package com.htdc.web.utils;

import java.text.DateFormat;
import java.text.ParseException;
import java.sql.Date;

public class DateUtils {

    public static final String YYYYMMDD = "yyyy-MM-dd";
    public static final String YYYYMMDDHHMMSS = "yyyy-MM-dd HH:mm:ss:SS";
    public static final String YYYY_MM_DD = "yyyy年MM月dd日";
    public static final String YYYYMMDD2 = "yyyy/MM/dd";

    public static int getDiffDays(String date, String date2) throws ParseException {
        DateFormat dateFormat = DateFormat.getDateInstance();
        Date d = Date.valueOf(date);
        long time1 = d.getTime();
        Date d2 = Date.valueOf(date2);
        long time2 = d2.getTime();
        return (int) (Math.abs(time2 - time1) / 1000 / 60 / 60 / 24);
    }

}
